import React, { Component } from "react";

class Refone extends Component {
  getdata = () => {
    console.log(this.refs.username.value);
  };
  render() {
    return (
      <>
        <h1>字符串形式的ref</h1>
        <input ref="username" type="text" />
        <button ref="btn" onClick={this.getdata}>
          点击获取
        </button>
      </>
    );
  }
}

export default Refone;
